package cn.iocoder.yudao.module.bpm.config;

import cn.iocoder.yudao.module.bpm.filter.FlowableWebFilter;
import cn.iocoder.yudao.module.bpm.filter.JWTAuthenticationTokenFilter;
import com.xueyi.common.core.enums.WebFilterOrderEnum;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class YudaoFlowableConfiguration {
    /**
     * 配置 flowable Web 过滤器
     */
    @Bean
    public FilterRegistrationBean<FlowableWebFilter> flowableWebFilter() {
        FilterRegistrationBean<FlowableWebFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new FlowableWebFilter());
        registrationBean.setOrder(WebFilterOrderEnum.FLOWABLE_FILTER);
        return registrationBean;
    }
    /**
     * 配置 flowable Web 过滤器
     */
    @Bean
    public FilterRegistrationBean<JWTAuthenticationTokenFilter> flowableAuthenticationWebFilter() {
        FilterRegistrationBean<JWTAuthenticationTokenFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new JWTAuthenticationTokenFilter());
        registrationBean.setOrder(WebFilterOrderEnum.TENANT_CONTEXT_FILTER);
        return registrationBean;
    }
}
